package com.qfedu.buy.server.service.impl;

import com.qfedu.buy.common.dto.GoodsSkuDetailDto;
import com.qfedu.buy.server.dao.GoodsSkuDao;
import com.qfedu.buy.server.service.intf.GoodsSkuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: NeighborBuy
 * @description:
 * @author: Feri(邢朋辉)
 * @create: 2021-02-04 09:40
 */
@Service
public class GoodsSkuServiceImpl implements GoodsSkuService {
    @Autowired
    private GoodsSkuDao skuDao;

    @Override
    public GoodsSkuDetailDto queryById(int id) {
        if(id>0){
            return skuDao.selectById(id);
        }else {
            return null;
        }
    }

    @Override
    public int changeStore(int id, int num) {
        if(id>0 && num!=0){
            return skuDao.update(id, num);
        }else {
            return -1;
        }
    }
}